cmake_minimum_required(VERSION 3.16)

project(kafka_qt VERSION 1.0 LANGUAGES CXX)

project(kafka_test VERSION 1.0 LANGUAGES CXX)

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
	if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
        message("MSYS2 should run pacman -S ..librdkafka first. We assume the packages has been installed.")
	else()
		message("Using build-in librdkafka.")
        include_directories(${PROJECT_SOURCE_DIR}/../../3rdlibs/rdkafka)
	    link_directories(${PROJECT_SOURCE_DIR}/../../3rdlibs/rdkafka)
	endif()
endif()


set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)



find_package(QT NAMES Qt6 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
#FIX QT6 Link BUG in msys2 Qt static
if (QT_FEATURE_static STREQUAL "ON" AND WIN32 AND MINGW)
	set_property(TARGET harfbuzz::harfbuzz PROPERTY
		IMPORTED_IMPLIB ${harfbuzz_DIR}../../../libharfbuzz.dll.a )
endif()


set(PRJ_HEADERS
	dialogkafka.h
	kafka_client.h
)

set(PRJ_SOURCES
	dialogkafka.cpp
	main.cpp
	kafka_client.cpp
)

set(PRJ_RESOURCES
)
# ========================Exe========================

add_executable(rdkafka_qt
	${PRJ_HEADERS}
	${PRJ_SOURCES}
	${PRJ_RESOURCES}
	dialogkafka.ui
)

target_link_libraries(rdkafka_qt PRIVATE
	Qt${QT_VERSION_MAJOR}::Widgets 
	rdkafka
)


